const url = require("url");

// let str = "http://localhost:8002/aaa?username=sdfsdf&content=234234#title4";

// let urlObj = url.parse(str);
// console.log(urlObj);

let obj =  {
    protocol: 'http:',
    slashes: true,
    auth: null,
    host: 'localhost:8002',
    port: '8002',
    hostname: 'localhost',
    hash: '#title4',
    search: '?username=sdfsdf&content=234234',
    query: 'username=sdfsdf&content=234234',
    pathname: '/aaa',
    path: '/aaa?username=sdfsdf&content=234234',
}

let str = url.format(obj)
console.log(str);

